package com.zhiche.lisa.tms.service.impl;


import com.baomidou.mybatisplus.mapper.EntityWrapper;
import com.baomidou.mybatisplus.service.impl.ServiceImpl;
import com.zhiche.lisa.tms.dao.mapper.ShipTaskLocationMapper;
import com.zhiche.lisa.tms.dao.model.ShipTaskLocation;
import com.zhiche.lisa.tms.service.IShipTaskLocationService;
import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils;

import java.util.List;

/**
 * <p>
 * 运输任务起止点信息 服务实现类
 * </p>
 *
 * @author qichao
 * @since 2018-06-18
 */
@Service
public class ShipTaskLocationServiceImpl extends ServiceImpl<ShipTaskLocationMapper, ShipTaskLocation> implements IShipTaskLocationService {


    @Override
    public ShipTaskLocation getShipTaskLocByTaskCode(String shipTaskCode) {
        ShipTaskLocation shipTaskLocation = null;
        EntityWrapper<ShipTaskLocation> ew = new EntityWrapper<>();
        ew.eq("ship_task_code",shipTaskCode);
        List<ShipTaskLocation> shipTaskLocations = this.selectList(ew);
        if(!CollectionUtils.isEmpty(shipTaskLocations)){
            shipTaskLocation = shipTaskLocations.get(0);
        }
        return shipTaskLocation;
    }
}
